'use strict';

module.exports = app => {
  const { INTEGER, STRING, DATE, TEXT, NOW } = app.Sequelize;

  const Page = app.model.define('page', {
    page_id: {
      type: INTEGER,
      primaryKey: true,
      autoIncrement: true,
      unique: true,
    },
    page_title: {
      type: STRING,
      defaultValue: '',
    },
    description: {
      type: STRING,
      defaultValue: '',
    },
    keyword: {
      type: STRING,
      defaultValue: '',
    },
    content: {
      type: TEXT,
      defaultValue: '',
    },
    cat_id: {
      type: INTEGER,
      defaultValue: 0,
      allowNull: false,
    },
    created_at: { type: DATE, defaultValue: NOW },
    update_at: { type: DATE, defaultValue: NOW },
  }, {
    timestamps: false,
    tableName: 'l_page',
  })

  return Page;
}
